home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / internet / sweeper / samples / surfbear / intern~1.h < prev    next >
C/C++ Source or Header  |  1995-12-04  |  2KB  |  74 lines

  1. #ifndef __InternetThread_h__
  2. #define __InternetThread_h__
  3. #include <wininet.h>
  4.  
  5. //   Return values for GetWebPageWorkerThread
  6. const UINT THREAD_GOOD = 0 ;
  7. const UINT THREAD_BAD = 1 ;
  8.  
  9. //
  10. // Message to post when thread is done.
  11. //
  12. #define WM_READFILECOMPLETED (WM_USER + 100)
  13.  
  14. //
  15. //  CInternetThread Class...manages worker thread which reads from Internet.
  16. //
  17. class CInternetThread
  18. {
  19. public:
  20.    // Construction
  21.    CInternetThread() ;
  22.    ~CInternetThread() ;
  23.  
  24.    // Initialization
  25.    BOOL Init(HWND hPostMsgWnd) ;
  26.  
  27.    // Re-initialized Internet functions. Used after changing access type.
  28.    void ResetSession() ;
  29.  
  30.    // Manage Buffer where HTML text is placed.
  31.    void EmptyBuffer()
  32.       { delete m_buffer ; m_buffer = NULL ; }
  33.    BOOL IsBufferEmpty() 
  34.       { return m_buffer == NULL;}
  35.    char* GetBuffer()
  36.       { return m_buffer ;}
  37.  
  38.    // Access Type 
  39.    int GetAccessTypeIndex() ;
  40.    void SetAccessTypeIndex(int index) ;
  41.  
  42.    // Proxy Server name.
  43.    CString& GetProxyServer() 
  44.       {return m_strProxyServer; }
  45.    void SetProxyServer(CString& strProxyServer) 
  46.       { m_strProxyServer = strProxyServer; ResetSession() ;}
  47.  
  48.    // Go get the requested Internet page.
  49.    void GetPage(CString& rAddress) ;
  50.  
  51. private:
  52.    // Worker thread calls _GetPageWorker.
  53.    static UINT GetWebPageWorkerThread(LPVOID pvThread) ;
  54.  
  55.    // This is where the actually work is done.
  56.    UINT _GetPageWorker() ;
  57.  
  58.    CString m_strServer ;
  59.    CString m_strPath ;
  60.    CString m_strProxyServer ;
  61.    DWORD m_dwAccessType ;
  62.    char* m_buffer ;
  63.  
  64.    HINTERNET m_hSession ;
  65.    HWND m_hPostMsgWnd ;
  66. };
  67.  
  68. //
  69. // Working Thread which does all the actually internet work.
  70. //
  71. UINT GetWebPageWorkerThread(LPVOID pvThreadData);
  72.  
  73. #endif 
  74.